<template>

    <div id="loginView"> 

       <dv-full-screen-container>
        
          <div class="top-header-login " style="position: flex;">
              <div id="login-img-box">
                <img width="70rem"  src="../../assets/images/u5.svg"  style="margin-left: 5px;"/> 
              </div>
              <div id="login-title-box">
                <div class="title-remark">
                  <div style="font-size:38px;"><span style="color:#03B4F5;">太平驿实时监测预警</span></div>
                  <div style="font-size:16px;   "><span style="color:rgba(255, 255, 255, 0.298039215686275);">Taiping station real-time monitoring and early warning</span></div>
                </div>
             </div>
             <div id="login-user-login-box"   >
                <img  class="login-top-img" src="../../assets/images/u9.svg" /> 
                <div id="login-form-background" >
                    <div class="login-form-background-img"></div>
                    <div class="login-form-title" >
                      <div class="login-form-title-left">&nbsp; 用户登录 USER LOGIN</div>
                      <div class="login-form-title-right" @mouseover="showDiv" @mouseleave="hideDiv"> 
                        <div class="fly-space-up" v-if="title_show" >
                          <div class="fly-space-up-div">需验证账号密码完成登录<br>
                                <div class="fly-space-up-div-small">账号：sdtz<br>
                                密码：12345678</div>
                          </div>
                       </div> 
                        登录说明</div>

                    </div>
                    <div class="login-form-username" @click="selectDiv(1)">
                      <div class="textbox"> 
                          <div class="lefticon"></div>
                          <div >
                            <input v-model="user.username" placeholder="请输入用户名称" type="text"  class="rightinput" />
                          </div>
                      </div>
                    </div>
                    <div class="login-form-password" @click="selectDiv(2)">
                      <div class="textbox"> 
                        <div class="lefticon"></div>
                        <div >
                          <input v-model="user.password"  placeholder="请输入密码" type="password"  class="rightinput" />
                        </div>
                      </div>
                    </div>
                    <div class="login-form-code-box">
                      <div class="login-form-code-box-left">
                        <div class="textbox"  @click="selectDiv(3)"> 
                          <div class="lefticon"></div>
                          <div class="">
                            <input v-model="user.code"   placeholder="请输入右侧验证码" type="text"  class="rightinput" />
                          </div>
                        </div>    
                      </div>
                      <div class="login-form-code-box-right">
                        <div class="code-watch"> 
                              1235
                        </div>    
                      </div>
                    </div>
                    <div class="login-form-foot">
                      <div class="login-form-foot-left">
                        
                          <div class="leftcheckbox"><input type="checkbox"></div>
                          <div class="righttext">
                            记住密码
                          </div>
                          
                      </div>
                      <div class="login-form-foot-right" @mouseover="showForget" @mouseleave="hideForget" >
                        
                          <div class="righttext">
                            <div class="fly-space-down" v-if="forget_show" >
                              <div class="fly-space-down-div">请联系管理员重置密码<br>
                                电话：400-888-8888
                              </div>
                            </div> 
                            忘记密码?
                          </div>
                      </div>
                    </div>
                    <div class="login-form-button">
                          <button class="button-login" @click="login"> 登录</button>
                    </div>
                </div>
                <img  class="login-down-img" src="../../assets/images/u10.svg"  /> 
             </div>
          </div>

        


      </dv-full-screen-container> 
    </div>
  </template>
  
  <script>
// 导入插槽组件
  import { mapActions, mapGetters } from 'vuex';
  import { ref, onMounted } from 'vue';
  export default {
    name: 'loginView',
    components: {
    },
    data () {
       
      return {
        title_show:false,
        forget_show:false,
        selected:1,
        opacity_value1:0.1,
        opacity_value2:0.1,
        opacity_value3:0.1,
        user:{}
      }
      
    },
    computed:{
        ...mapGetters(['token','loginState','userInfo'])
    },
    methods: { 
      login: function(){
          const user = this.user;
          this.loginAction(user);
          if(this.loginState!='false'){
            localStorage.setItem("user_login", this.loginState);
            console.log("跳转")
            this.$router.push({name:'/screen'});
          }
      },
      // 创建js函数
      //打开登录说明
      showDiv: function(){

        this.title_show=1;
       },
      //关闭登录说明
      hideDiv: function(){

        this.title_show=0;
       },
       //打开忘记密码
      showForget: function(){

        this.forget_show=1;
       },
       //关闭忘记密码
      hideForget: function(){

        this.forget_show=0;
       },
       //边框透明度选择效果
       selectDiv: function(num){
          console.log("selectDiv="+num)
          if(num==1){
            this.opacity_value1=1;
            this.opacity_value2=0.1;
            this.opacity_value3=0.1;
          }else if(num==2){
            this.opacity_value1=0.1;
            this.opacity_value2=1;
            this.opacity_value3=0.1;
          }else if(num==3){
            this.opacity_value1=0.1;
            this.opacity_value2=0.1;
            this.opacity_value3=1;
          }
      },
      ...mapActions(['loginAction']),
    },
    setup() {
        const root = ref(null)
       
        onMounted(() => {
        })
        return {root}
    }
  }
  </script>
  
  <style lang="less">

    input[type="text"],input[type="password"] {
      border: none;
      box-shadow: none;
      outline: none;
      background: none;
      color:#fff;
      font-size:16px;
    /* 去掉默认的输入框样式 */
    }
    input:focus::placeholder{
        opacity: 0;
    }
    .rightinput::placeholder{
       color: rgb(95, 136, 179,0.5);
    }
    #loginView{
      background-color: #061F57;
      color: #fff;
      width: 100%;
      height: 100%;
      overflow: auto;
      #dv-full-screen-container {
        background-image: url('../../assets/images/u1_state0.jpg');
        width: 100%;
        height: 100%;
        background-size: cover;
        box-shadow: 0 0 3px #061F57;
        display: flex;
        flex-direction: column;
      }
     }

     .top-header-login {  
          width: 30rem;
          height: 38rem; 
          justify-content: space-between;
          flex-shrink: 0;
          position: absolute;
          top:12rem;
          left:68.5rem;
          #login-img-box{
            width: 4.8rem;
            float: left;
            height: 5rem;

          }
          #login-title-box{
            float: right;
            width: 24rem;
            height: 5rem;
            padding: 0rem 0.5rem;
            
          }
          #login-user-login-box{
            margin-top:8rem;
            width: 28.2rem;
            height: 28.7rem;
            position: relative;
          }
          #login-user-login-box::after {
            content: "";
            background-image: url(../../assets/images/u8.svg); 
            opacity: 0.5;
            position: absolute;  
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
          }
          #login-form-background{
            width: 28rem;
            height: 27.8rem;
          }
          #login-form-background::after {  
            content: "";
            background-image: url(../../assets/images/u3.svg); 
            opacity: 0.1;
            position: absolute;  
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
          }
          
          .login-top-img{
            position: absolute;
            top:-0.8rem
          }
          .login-down-img{
            position: absolute;
            top:28rem
          }
          .login-form-title{
            width: 26rem;
            height: 1.3rem;
            padding: 2rem 2rem 2rem 1.8rem;
            line-height: 24px;
            background-color: rgba(255, 255, 255, 0);
            .login-form-title-left{ 
              float: left;
              background: inherit;
              background-color: rgba(255, 255, 255, 0);
              box-sizing: border-box;
              border-width: 5px;
              border-style: solid;
              border-color: rgba(3, 180, 245, 1);
              border-top: 0px;
              border-right: 0px;
              border-bottom: 0px;
              border-radius: 0px;
              border-top-left-radius: 0px;
              border-bottom-left-radius: 0px;
              -moz-box-shadow: none;
              -webkit-box-shadow: none;
              box-shadow: none;
              font-family: '微软雅黑', sans-serif;
              font-weight: 400;
              font-style: normal;
              font-size: 20px;
              color: #03B4F5;
              text-align: left;
              margin-left: 0.5rem;
            }
            .login-form-title-right{ 
              
              float: right;
              line-height: 28px;
              margin-right: 0;
              font-family: '微软雅黑', sans-serif;
              font-weight: 400;
              font-style: normal;
              color: rgba(255, 255, 255, 0.647058823529412);
              text-align: right;
              font-size: 13px;
              letter-spacing: normal;
              margin-right: 2rem;
              position: absolute;
              right: 0;
              z-index: 30;                                                                                                                                                                                       ;
            }
          }
          .login-form-username{
            width: 23.7rem;
            height: 3rem;
            margin: 0.5rem 2.1rem;
            border: 1px solid rgba(3,180,245,v-bind(opacity_value1));
            
          }
          .textbox{
              width: 26rem;
              height: 3rem;
              position: relative;
            }
            .lefticon{
              top:0.6rem;
              left:1rem;
              text-align: center;
              position: absolute;
              font-family: 'Font Awesome 5 Pro Solid', 'Font Awesome 5 Pro Regular', 'Font Awesome 5 Pro', sans-serif;
              font-weight: 900;
              font-style: normal;
              font-size: 18px;
              color: #03B4F5;
            }
            .rightinput{
                width: 20rem;
                height: 2rem;
                left: 50px;
                position: absolute;
                top: 8px;
                z-index: 20;
            }
            .codeBox{
                width: 16rem;
                height: 2rem;
                left: 50px;
                position: absolute;
                top: 8px;
                z-index: 20;
            }
          .login-form-password{
            width: 23.7rem;
            height: 3rem;
            margin: 1.1rem 2.1rem  0.5rem 2.1rem;
            border: 1px solid rgba(3,180,245,v-bind(opacity_value2));
          }
          .login-form-code-box{
            position: relative;
            height: 4.2rem;
          }
          .login-form-code-box-left{
            width: 16.7rem;
            height: 3rem;
            margin: 0.5rem 0.1rem 0.5rem 2.1rem;
            border: 1px solid rgba(3,180,245,v-bind(opacity_value3));
            float: left;
          }
          .login-form-code-box-right{
            width: 6rem;
            height: 3rem;
            float: right;
            margin: 0.5rem 2.1rem 0.5rem 0.1rem;
            border: 1px solid rgba(3,180,245,0.1);
          }
          .code-watch{
            width: 6rem;
            position: absolute;
            align-self: center;
            padding: 2px 2px 2px 2px;
            box-sizing: border-box;
            font-family: 'MV Boli Normal', 'MV Boli', sans-serif;
            font-weight: 400;
            font-style: normal;
            font-size: 28px;
            color: #FFFFFF;
            text-align: center;
            line-height: normal;
          }
          .login-form-foot{
            width: 23.7rem;
            height: 2rem;
            margin: 0.5rem 2.1rem 0 2.1rem;
            position: relative;
            font-size: 14px;
            color: rgba(181, 189, 199);
          }
          .login-form-foot-left{
            position: relative;
            float: left;
            margin-left: 0.2rem;
          }
          .login-form-foot-right{
            margin-right: 0.2rem;
            position: absolute;
            float: right;
            right: 0;
            z-index: 30;
          }
          .leftcheckbox{
            position: absolute;
            float: left;
            width: 1rem;
            height: 1rem;
            z-index: 20;
          }
          .righttext{
            position: relative;
            float: right;
            margin-left: 1.5rem;
          }
          .login-form-button{
            width: 23.7rem;
            height: 3rem;
            margin: 0 2.1rem;
            position: absolute;
            z-index:30
          }
          .button-login{
            width: 100%;
            height: 100%;
            color: #fff;
            background-color: #03B4F5;
            font-size: 18px;
            text-align: center;
            margin: 0;
            padding: 0;
            border: none;
          }
          .fly-space-up{
            color: rgba(181, 189, 199);
            font-size: 14px;
            content: "";
            background-image: url(../../assets/images/背景_u48.svg); 
            background-size: cover;
            position: absolute; 
            width:11.5rem ;
            height: 5.65rem;
            z-index: 30;
            margin: 0;
            padding: 0;
            right:-0.1rem;
            top:1.4rem;
            text-align: left;
            line-height: 20px;
            .fly-space-up-div{
             
              padding: 1.3rem 0.5rem 0rem 0.9rem;
            }
            .fly-space-up-div-small{
              font-size: 10px;
            }
          }

            .fly-space-down{
              color: rgba(181, 189, 199);
              font-size: 14px;
              content: "";
              background-image: url(../../assets/images/气泡提示_u35.svg); 
              background-size: cover;
              position: absolute; 
              width:11rem ;
              height: 4.2rem;
              z-index: 30;
              margin: 0;
              padding: 0rem;
              right:-0.6rem;
              top:-4.3rem;
              text-align: left;
              line-height: 20px;
              .fly-space-down-div{
                padding: 0.5rem 0.5rem 0.5rem 0.9rem;
              }
          }
    }
    
  </style>